define(["jquery","bbcare"],function($,$bb){
	var servers = {};
	var URL = $bb.baseUrl("followup");

	/**
	 * 离线建档数据提交
	 */
	servers.ajaxPatientAddNew = function(cacheSave,i,total,callback){
		$bb.ajax({
			url: URL + "followup/service/treat/patientAddNew",
			data:JSON.stringify({
				data : cacheSave[i].params
			}),
			success: function(data){
				callback(data,cacheSave,i,total);
			}
		});
	}

	/**
	 * 离线门诊任务数据提交
	 */
	servers.ajaxSubmitOfflineTaskCont = function(cacheSave,i,total,callback){
		$bb.ajax({
			url: URL + "followup/service/offline/submitOfflineTaskCont",
			data:JSON.stringify({
				data : cacheSave[i].params
			}),
			success: function(data){
				callback(data,cacheSave,i,total);
			}
		});
	}

	/**
	 * 离线门诊上传图片 （暂时未用）
	 */
	servers.ajaxUploadMultiFile = function(cacheSave,i,total,callback){
		var urlArr = cacheSave[i].params;
		var fd = new FormData();
		for (var j = 0; j < urlArr.length; j++) {
			fd.append(i, urlArr[i]);
		}
		$bb.ajax({
            url: URL + "followup/service/treat/uploadMultiFile",
            processData: false,  // 告诉jQuery不要去处理发送的数据
            contentType: false,   // 告诉jQuery不要去设置Content-Type请求头
            data: fd,
            success: function(data){
                callback(data,cacheSave,i,total);
            }
        });
	}

	return servers;
});